package com.yunhe.java.pro12JiHe;

/**
 * Created by Administrator on 2017/8/5 0005.
 */
public class Student implements Comparable<Student> {
    private  String name;
    private  int age;
    public Student (){}
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "name:"+name+":"+age;
    }
    @Override
    public int compareTo(Student stu) {
        int value=0;
        if(stu.getAge()>this.getAge())
            value=-1;
        if(stu.getAge()<this.getAge())
            value=1;
            return value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
